<?php
declare (strict_types=1);

namespace app\controller;

use app\BaseController;
use app\model\Calendar;
use app\model\Config;
use app\model\Project;
use app\model\User;
use GuzzleHttp\Client;
use Ip2Region;
use JiGuang\JSMS;
use think\facade\Route;
use think\Request;

class IndexController extends BaseController
{
	protected $middleware = [
		'Login' => [
			'except' => ['index','test', 'project'],
		],
		
	];
	
	function index()
	{
		$time = '2024-1-30 19:0';
		//每天  30天
		for ($i = 0; $i < 30; $i++) {
			$starttimes = date('Y-m-d H:i:s', strtotime($time .'+'. $i . ' days'));

			dump($starttimes);
		}
	}
	
	function test(Request $request)
	{
		$file = $request->file('file');
		if ($file){
			$isFile = $file->isFile();
			$content = $file->getPathname();
		}else{
			$isFile = false;
			$content = '';
			
		}
		
		$this->writeJson(['isFile'=>$isFile,'Pathname'=>$content]);
	}
	
	/**
	 * 项目列表
	 * @return void
	 */
	function project()
	{
		$rows = Project::order(['weigh' => 'desc'])->select();
		$this->writeJson($rows);
	}
}
